package com.itheima.sc.impl.order;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.itheima.sc.api.order.OmsOrderSettingApi;
import com.itheima.sc.mapper.order.OmsCompanyAddressMapper;
import com.itheima.sc.mapper.order.OsmOrderSettingMapper;
import com.itheima.sc.pojo.order.OmsCompanyAddress;
import com.itheima.sc.pojo.order.OmsOrderSetting;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class OmsOrderSettingImpl implements OmsOrderSettingApi {
@Autowired
    OsmOrderSettingMapper osmOrderSettingMapper;

    @Override
    public OmsOrderSetting getSettingById(Long id) {
        return osmOrderSettingMapper.selectById(id);
    }

    @Override
    public void updateSetting(Long id, OmsOrderSetting omsOrderSetting) {
        LambdaUpdateWrapper<OmsOrderSetting>updateWrapper=new LambdaUpdateWrapper<>();
        updateWrapper.eq(OmsOrderSetting::getId,id);
        osmOrderSettingMapper.update(omsOrderSetting,updateWrapper);
    }
@Autowired
    OmsCompanyAddressMapper omsCompanyAddressMapper;
    @Override
    public List<OmsCompanyAddress> getAddress() {
        //所有地址
        return omsCompanyAddressMapper.selectList(new LambdaQueryWrapper<>());
    }
}
